package org.processmining.plugins.complianceframework.visualization;

import javax.swing.JComponent;
import javax.swing.SwingConstants;

import org.processmining.contexts.uitopia.UIPluginContext;
import org.processmining.contexts.uitopia.annotations.Visualizer;
import org.processmining.framework.plugin.annotations.Plugin;
import org.processmining.framework.util.ui.scalableview.ScalableComponent;
import org.processmining.framework.util.ui.scalableview.ScalableViewPanel;
import org.processmining.framework.util.ui.scalableview.ScalableComponent.UpdateListener;
import org.processmining.plugins.DataConformance.ResultReplay;
import org.processmining.plugins.DeclareConformance.Analyze.AnalyzePanel;
import org.processmining.plugins.DeclareConformance.Analyze.Summary;
import org.processmining.plugins.complianceframework.InstanceClassificatior;

import weka.gui.treevisualizer.PlaceNode2;
import weka.gui.treevisualizer.TreeVisualizer;

public class ProblemInsightVisualizer {
	@Plugin(name = "Visualize problem insight", parameterLabels = { "Problem insight" }, returnLabels = { "Visualization" }, returnTypes = { JComponent.class }, userAccessible = false, help = "Visualize problem insight")
	@Visualizer
	public JComponent plugin(UIPluginContext context,
			InstanceClassificatior classificator) throws Exception {
		final TreeVisualizer tv = new TreeVisualizer(null,
				classificator.getGraph(), new PlaceNode2());
		ScalableViewPanel tvScalable = new ScalableViewPanel(
				new ScalableComponent() {

					public void setScale(double newScale) {
					}

					public void removeUpdateListener(UpdateListener listener) {
					}

					public double getScale() {
						return 1;
					}

					public JComponent getComponent() {
						return tv;
					}

					public void addUpdateListener(UpdateListener listener) {
					}
				});
		return tvScalable;
	}
}
